package com.fcy.teamwork.security.environment

import android.content.Context
import com.fcy.teamwork.security.environment.checknode.*

object EnvironmentSec {
    private val netListener = ProxyCheck()
    const val isDebug = false
    private const val default = ""
    fun isEnvSec(context: Context): Boolean {
        if (isDebug)
            return true
        val securityNodes = listOf(
            XposedCheck(),                   // step 5. 检查是否使用Xposed进行debug
            RunningEnvCheck(),              // step 2. 检查是否运行在模拟器
            ProxyCheck(),                   // step 3. 是否使用了代理
            RootCheck(),                     // step 4. 检查是否root
        )
        return securityNodes.firstOrNull { !it.isSecurity(context) } == null
    }

    fun proxyCheck(context: Context): Boolean = netListener.isSecurity(context)
}